package com.ssy.lingxi.logistics.entity;

import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 物流单实体
 * @author yzc
 * @version 2.0.0
 * @date 2020/7/20
 */
@Data
@Entity
@Table(schema = "public", name = "ls_logistics_order",
        indexes = {@Index(name = "ls_logistics_order_member_id_idx", columnList = "memberId"),
                @Index(name = "ls_logistics_order_role_id_idx", columnList = "roleId"),
                @Index(name = "ls_logistics_order_company_id_idx", columnList = "companyId")})
public class LogisticsOrder implements Serializable {

    private static final long serialVersionUID = 1436243046614719275L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "logistics_order_seq")
    @SequenceGenerator(sequenceName = "ls_logistics_order_seq", name = "logistics_order_seq", allocationSize = 1)
    private Long id;

    /**
     * 物流单号
     */
    @Column
    private String logisticsOrderNo;

    /**
     * 外部状态 1-待提交 2-待确认 3-不接受物流单 4-接受物流单
     */
    @Column
    private Integer status;

    /**
     * 单据摘要
     */
    @Column(columnDefinition = "varchar(60)")
    private String digest;

    /**
     * 物流服务商id
     */
    @Column
    private Long companyId;

    /**
     * 物流服务商名称
     */
    @Column
    private String companyName;

    /**
     * 发货单id(进销存单据)
     */
    @Column
    private Long shipmentOrderId;

    /**
     * 发货单号(进销存单据)
     */
    @Column
    private String shipmentOrderCode;

    /**
     * 对应订单id
     */
    @Column
    private Long relevanceOrderId;

    /**
     * 对应单据编号
     */
    @Column
    private String relevanceOrderCode;

    /**
     * 对应单据类型(物流能力创建) 1-销售订单 2-换货申请单(退货发货) 3-换货申请单(换货发货) 4-退货申请单
     */
    @Column
    private Integer relevanceType;

    /**
     * 创建方式 1-物流能力创建 2-销售发货订单创建 3-生产通知订单创建 4-换货申请创建 5-换货处理创建 6-退货申请创建
     */
    @Column
    private Integer createType;

    /**
     * 发货方会员id
     */
    @Column
    private Long memberId;

    /**
     * 发货方角色id
     */
    @Column
    private Long roleId;

    /**
     * 发货方会员名称
     */
    @Column
    private String memberName;

    /**
     * 发货方名称
     */
    @Column
    private String shipperName;

    /**
     * 发货方手机
     */
    @Column
    private String shipperPhone;

    /**
     * 发货方地址id
     */
    @Column
    private Long shipperAddressId;

    /**
     * 发货方全地址
     */
    @Column
    private String shipperFullAddress;

    /**
     * 收货方会员id
     */
    @Column
    private Long receiverMemberId;

    /**
     * 收货方会员角色id
     */
    @Column
    private Long receiverRoleId;

    /**
     * 收货方地址id
     */
    @Column
    private Long receiverAddressId;

    /**
     * 收货方会员名称
     */
    @Column
    private String receiverMemberName;

    /**
     * 收货方名称
     */
    @Column
    private String receiverName;

    /**
     * 收货方手机
     */
    @Column(columnDefinition = "varchar(20)")
    private String receiverPhone;

    /**
     * 收货人全地址
     */
    @Column
    private String receiverFullAddress;

    /**
     * 总箱数
     */
    @Column
    private Double totalCarton;

    /**
     * 总重量
     */
    @Column
    private Double totalWeight;

    /**
     * 总体积
     */
    @Column
    private Double totalVolume;

    /**
     * 运费
     */
    @Column
    private BigDecimal freightPrice;

    /**
     * 是否含税 0-否 1-是
     */
    @Column
    private Integer taxInclusive;

    /**
     * 税率(小数, 50% = 0.50)
     */
    @Column(columnDefinition = "decimal")
    private Double taxRate;

    /**
     * 结算方式
     */
    @Column
    private String settlementWay;

    /**
     * 工作流任务Id
     */
    @Column
    private String taskId;

    /**
     * 创建时间
     */
    @Column
    private Long createTime;

    /**
     * 确认时间
     */
    @Column
    private Long confirmTime;
}
